﻿#pragma once
#include "afxdialogex.h"
#include "CLogRecord.h"
#include "CLogEditWnd.h"
#include "CFindResultWnd.h"
#include <vector>
using namespace std;
#define LV_ALL_SCIN              0x0000
#define LV_INFO_SCIN            0x0001
#define LV_DEBUG_SCIN          0x0002  
#define LV_ERROR_SCIN            0x0004
#define LV_IMPORTANT_SCIN          0xFFFF


#define ID_SCIN_FIND_RESULT 10099
// CDialogLogScin 对话框
class CDialogLogScin : public CDialogEx
{
	DECLARE_DYNAMIC(CDialogLogScin)

public:
	CDialogLogScin(CWnd* pParent = nullptr);   // 标准构造函数
	CDialogLogScin(CWnd* pParent = nullptr, string fileDir = "");
	virtual ~CDialogLogScin();
	virtual BOOL OnInitDialog();
// 对话框数据
#ifdef AFX_DESIGN_TIME
	enum { IDD = IDD_DIALOG_LOG };
#endif

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持

	DECLARE_MESSAGE_MAP()
private:
	//根据日志容器显示日志到list中
	void SetLogShow();
	//根据combo选择的日志等级筛选日志
	void FilterLogVector();
	void AdjustSize(bool isInit);
	//初筛出重要日志
	void FilterImportantVector(vector<CLogRecord>& vLogRecord);
private:
	CLogEditWnd *m_LogEditWnd;//日志显示控件
	CFindResultWnd* m_FindResultWnd;//搜索结果显示控件
	CEdit M_EditSearch;
	CButton m_SearchBtn;
	vector<CLogRecord> m_vLogRecord;
	vector<CLogRecord> m_vLogShow;
	string m_FileDir;//文件路径
	int m_SearchIndex;//搜索开始索引
	int m_FilterLevel;//筛选登记
	CButton m_SearchNext;
	CButton m_RadioError;
	CButton m_RadioDebug;
	CButton m_RadioInfo;
	CButton m_RadioAll;
	CButton m_RadioImport;
	CButton m_RadioReg;
	CString SearchTxt;
public:
	afx_msg void OnBnClickedButtonSearchScin();
	afx_msg void OnBnClickedCheckInfoScin();
	afx_msg void OnBnClickedCheckDebugScin();
	afx_msg void OnBnClickedCheckErrorScin();
	afx_msg void OnBnClickedCheckAllScin();
	afx_msg void OnBnClickedCheckImportantScin();
	afx_msg void OnBnClickedRegScin();
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
};
